package com.xiaojf.xlog.appender.rdb.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;

/**
 * 访问日志
 *
 * @author Ade.Xiao 2021/3/12 11:25
 */

@Entity
@Table(name = "access_log")
public class AccessLog implements Serializable {
    private static final long serialVersionUID = -1308546163258306221L;
    /**
     * id
     */
    @Id
    @GeneratedValue(generator = "idStrategy")
    @GenericGenerator(name = "idStrategy", strategy = "uuid")
    private String id;
    @JsonFormat(
            pattern = "yyyy-MM-dd HH:mm:ss"
    )
    /**
     * 创建时间
     */
    private Date createdTime;
    @JsonFormat(
            pattern = "yyyy-MM-dd HH:mm:ss"
    )
    /**
     * 更新时间
     */
    private Date updatedTime;
    /**
     * 创建人
     */
    private String creator;
    /**
     * 更新人
     */
    private String updator;
    /**
     * 备注
     */
    private String remark;

    /**
     * 请求uri
     */
    private String uri;
    /**
     * ip地址
     */
    private String ip;
    /**
     * 访问时间
     */
    private Long accessTime;
    /**
     * 耗时
     */
    private Long appendTime;
    /**
     * 日志内容
     */
    private String content;

    /**
     * 请求是否成功
     */
    private boolean successful = true;

    /**
     * 错误日志
     */
    private String error;

    /**
     * 操作类型
     */
    private String operateType;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Date getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(Date createdTime) {
        this.createdTime = createdTime;
    }

    public Date getUpdatedTime() {
        return updatedTime;
    }

    public void setUpdatedTime(Date updatedTime) {
        this.updatedTime = updatedTime;
    }

    public String getCreator() {
        return creator;
    }

    public void setCreator(String creator) {
        this.creator = creator;
    }

    public String getUpdator() {
        return updator;
    }

    public void setUpdator(String updator) {
        this.updator = updator;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getUri() {
        return uri;
    }

    public void setUri(String uri) {
        this.uri = uri;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public Long getAccessTime() {
        return accessTime;
    }

    public void setAccessTime(Long accessTime) {
        this.accessTime = accessTime;
    }

    public Long getAppendTime() {
        return appendTime;
    }

    public void setAppendTime(Long appendTime) {
        this.appendTime = appendTime;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public boolean isSuccessful() {
        return successful;
    }

    public void setSuccessful(boolean successful) {
        this.successful = successful;
    }

    public String getError() {
        return error;
    }

    public void setError(String error) {
        this.error = error;
    }

    public String getOperateType() {
        return operateType;
    }

    public void setOperateType(String operateType) {
        this.operateType = operateType;
    }
}
